This example uses the addEventListener() method to attach "dragstart", "dragend", "dragover" and "drop" events to the document object.

Drag the p element back and forth between the two rectangles:

Drag me!

Note: drag events are not supported in Internet Explorer 8 and earlier versions or Safari 5.1 and earlier versions.